layui.use(['laydate','form'], function(){
    var laydate = layui.laydate;
    var form = layui.form;

    testObj = {
    init: function(){
        this.bindEvent();
    },
    bindEvent: function(){
        // 开始时间
        var start = laydate.render({
            elem: '#start',
            trigger: 'click',
            btns: ['clear', 'confirm'],
            // showBottom: false,
            done: function (value, date) {
                end.config.min = {
                    year: date.year,
                    month: date.month - 1,
                    date: date.date,
                    hours: date.hours,
                    minutes: date.minutes,
                    seconds: date.seconds
                };
                // 作为 结束选择 的 开始时间
                end.config.value = value;
            }
        });
        // 结束时间
        var end = laydate.render({
            // 绑定元素
            elem: '#end',
            //  触发方式
            trigger: 'click',
            // 底部按钮
            btns: ['clear', 'confirm'],
            // showBottom: false,
            // 选择完成回调
            done: function (value, date) {
                start.config.max = {
                    year: date.year,
                    month: date.month - 1,
                    date: date.date,
                    hours: date.hours,
                    minutes: date.minutes,
                    seconds: date.seconds
                };
                start.config.value = value;
            }
        });
        laydate.render(start);
        laydate.render(end);
    }
}
testObj.init();

//退货
$('body').on('click', '.tuihuo', function(){
    var get_this = $(this);
    parent.layer.confirm('你确定要退货吗?', function(){
        var params = {};
        params.id = get_this.attr('gid');
        $.ajax({
            type: "POST",
            url: "/shop/goods/delgoods.html",
            cache: false, //禁用缓存
            data: params, //传入组装的参数
            dataType: "json",
            success: function (result) {
                if(result.code==10001){
                    parent.layer.msg('操作成功', {icon: 1});
                }else{
                    parent.layer.msg(result.msg, {icon: 5});
                }
            },
            error:function () {
                parent.layer.msg('网络错误', {icon: 5});
            }
        })
    });
});























});